#include<iostream>
using namespace std;
const int N = 1e5 + 10;
int d[N], o[N];
int n;
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> d[i];
	//0
	for (int i = n; i >= 1; i--) {
		if (n == i)o[i] = d[i] ^ 0;
		else o[i] = d[i] ^ o[i + 1];
	}
	if (o[1] != 0) {
		cout << "false" << endl;
		return 0;
	}
	//1
	for (int i = n; i >= 1; i--) {
		if (n == i)o[i] = d[i] ^ 1;
		else o[i] = d[i] ^ o[i + 1];
	}
	if (o[1] != 1) {
		cout << "false" << endl;
		return 0;
	}
	cout << "true" << endl;
	return 0;
}